package test.练习1;

import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class Clinet {
    public static void main(String[] args) throws Exception {
        //创建一个Socket对象，构造方法中指定服务器的IP地址和端口号
        Socket s = new Socket("127.0.0.1", 10086);

        //写出数据

        OutputStream outputStream = s.getOutputStream();
        Scanner sc = new Scanner(System.in);
        while (true) {
            String str = sc.nextLine();
            outputStream.write(str.getBytes());
            if ("88".equals(str)) {
                break;
            }
        }
        //关闭资源
        s.close();
    }
}
